import { GameEventListener } from "@/types/game/event";
import eventCreatorList from "./event-creator";
import eventList from "./event-list";
const listenerList = {
    gameStart: [
        {
            name: 'trigger:use-lord-card',
            async callback(event, gameData, gameAction, { addEvent }) {
                const { playerStates: { playerList } } = gameData;
                for (let player of playerList) {
                    player.lordCards.forEach(lordcard => {
                        addEvent(eventCreatorList.playerUseLordCard(player, lordcard))
                    })
                }
            }
        },
        {
            name: 'trigger:start-round-loop',
            async callback(event, gameData, gameAction, { addEvent }) {
                addEvent(eventList.gameRoundStart);
            },
            order: -Infinity
        }
    ],

} as { [key: string]: GameEventListener[] }
export default listenerList